package com.yq.day22._01date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 3307235355@qq.com
 * @since 2022/06/22 17:11
 */
public class Demo01 {
    public static void main(String[] args) throws ParseException {
        Date date = new Date();
        System.out.println(date);
        // date -> string
        SimpleDateFormat s1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String s2 = s1.format(date);
        System.out.println(s2);

        //    string -> date
        String date1 = "2022-8-12 12:55:12";
        Date parse = s1.parse(date1);
        System.out.println("parse = " + parse);

    //    获取当前系统的时间戳
        long l = System.currentTimeMillis();
        System.out.println(l);


    }
}
